/*LwX9zXiBCj10VB2kWO20v7fWcwr9V5PRW/U0t9iQXOBeK+vexQ6EVqpXTNmb3VQR*/
import React, { Component } from 'react';
import { high, base, ajax, getMultiLang ,createPage} from 'nc-lightapp-front';
const { NCTable, NCModal, NCButtonGroup, NCButton, NCDiv } = base;
let columns_report = [
	{
		title: (<div fieldid="serial">{''}</div>) /* 国际化处理： 序号*/,
		dataIndex: 'serial',
		key: 'serial',
		render: (text, record, index) => <div fieldid="serial">{text ? text : <span>&nbsp;</span>}</div>
	},
	{
		title: (<div fieldid="notQualified">{''}</div>) /* 国际化处理： 月检查不合格单据*/,
		dataIndex: 'notQualified',
		key: 'notQualified',
		render: (text, record, index) => <div fieldid="notQualified">{text ? text : <span>&nbsp;</span>}</div>
	},
	{
		title: (<div fieldid="result">{''}</div>) /* 国际化处理： 检查结果*/,
		dataIndex: 'result',
		key: 'result',
		render: (text, record, index) => <div fieldid="result">{text ? text : <span>&nbsp;</span>}</div>
	}
];
 class ReportModal extends Component {
	constructor(props) {
		super(props);
		this.state = {
			reportdata:null,
			json: {}
		};
	}
	componentDidMount() {
		this.props.onRef(this);
	}
	componentWillMount() {
		let callback = (json) => {
			this.setState({ json: json }, () => {
				columns_report = [
					{
						title: (<div fieldid="serial">{this.state.json['public-000028']}</div>) /* 国际化处理： 序号*/,
						dataIndex: 'serial',
						key: 'serial',
						render: (text, record, index) => <div fieldid="serial">{text ? text : <span>&nbsp;</span>}</div>
					},
					{
						title: (<div fieldid="notQualified">{this.state.json['public-000029']}</div>) /* 国际化处理： 月检查不合格单据*/,
						dataIndex: 'notQualified',
						key: 'notQualified',
						render: (text, record, index) => <div fieldid="notQualified">{text ? text : <span>&nbsp;</span>}</div>
					},
					{
						title: (<div fieldid="result">{this.state.json['public-000030']}</div>)/* 国际化处理： 检查结果*/,
						dataIndex: 'result',
						key: 'result',
						render: (text, record, index) => <div fieldid="result">{text ? text : <span>&nbsp;</span>}</div>
					}
				];
			});
		};
		getMultiLang({ moduleId: 'public', domainName: 'arap', currentLocale: 'simpchn', callback });
	}
	openModal=(data)=>{
		//this.props.reportTableData = data;
		this.setState({reportdata:data})
		this.props.modal.show('settleAccounts');
		//this.setState({});
	}
    closeModal=()=>{
		this.props.modal.close('settleAccounts');
	}
	render() {
		let { showReportModal, handleClose, reportTableData, onReckoningOver, controlSettleButton, title, modal } = this.props;
		let {reportdata} = this.state;
		let { createModal } = modal;
		reportTableData = reportdata;
		return (
			<div id="finalTreatment_report">
				<div className="msg-modal finalTreatment-modal">
					{createModal('settleAccounts', {
						title: title,
						content: <NCDiv fieldid="ncc" areaCode={NCDiv.config.TABLE}>
							<NCTable
								columns={columns_report}
								bordered
								isDrag
								data={reportTableData}
								scroll={{
									x: columns_report.length > 8 ? 100 + (columns_report.length - 8) * 15 + '%' : '100%',
									y: 468
								}}
							/>
						</NCDiv>,
						showCustomBtns: true,
						customBtns: <div>{controlSettleButton ? (
							<NCButtonGroup>
								<NCButton fieldid="complete" colors="primary" onClick={onReckoningOver} style={{ padding: '0 10px' }}>
									{this.state.json['public-000033']}
									{/* 国际化处理： 完成结账*/}
								</NCButton>
							</NCButtonGroup>
						) : null}</div>
					})}
				</div>
			</div>
		);
	}
}
ReportModal = createPage(
	{
		//initTemplate: initTemplate
	}
)(ReportModal);
export default ReportModal ;

/*LwX9zXiBCj10VB2kWO20v7fWcwr9V5PRW/U0t9iQXOBeK+vexQ6EVqpXTNmb3VQR*/